# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=keybase-client
pkgver=6.2.8
pkgrel=2
pkgdesc="CLI client for keybase.io"
url="https://github.com/keybase/client"
arch="all"
license="BSD-3-Clause"
makedepends="go"
options="!check" # need access to localhost:3000, which doesn't work with our infra
source="$pkgname-$pkgver.tar.gz::https://github.com/keybase/client/archive/v$pkgver.tar.gz"
builddir="$srcdir/client-$pkgver"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	cd "$srcdir"
	export GOPATH="$PWD"

	mkdir -p src/github.com/keybase
	cp -r "$srcdir/client-$pkgver" src/github.com/keybase/client
	cd src/github.com/keybase/client/go/keybase
	go build -v -a -tags production -o "$srcdir/keybase"
}

package() {
	install -Dm755 "$srcdir/keybase" "$pkgdir/usr/bin/keybase"
}

sha512sums="
61e590a4de3a240f814d33e90b92a2db3662a871e354c5a48fa72d2ee597701b5fcac4f9f8cb520d99f66e139939b05b37477332dbb03e8816a19755e922caeb  keybase-client-6.2.8.tar.gz
"
